define(['app'], function(app) {
	'use strict';

	// 实例化方法
	var factory = function(Http) {
		function get_data_refund_list(result){
			if(HTTP_ISLOGIC){
				result = '{"sucsse":true,"msg":"value","result":{"page":[{"limit":8,"tPage":1,"cPage":5,"count":"value"}],"order":[{"order_id":1,"status":"2","member_id":123,"uname":"王大锤","apply_time":"2020-12-12","comp_id":123,"shop_no":12345678,"is_intervene":3,"refund_status":1},{"order_id":2,"status":"12","member_id":123,"uname":"王大锤","apply_time":"2020-13-12","comp_id":1234,"shop_no":123456784,"is_intervene":2,"refund_status":3},{"order_id":1,"status":"16","member_id":123,"uname":"王大锤","apply_time":"2020-12-12","comp_id":123,"shop_no":12345678,"is_intervene":3,"refund_status":4},{"order_id":1,"status":"5","member_id":123,"uname":"王大锤","apply_time":"2020-12-12","comp_id":123,"shop_no":12345678,"is_intervene":3,"refund_status":2}]}}';
				return JSON.parse(result);
			}else
			return result;
		}
		function get_data_return_send(result){
			if(HTTP_ISLOGIC){
				result = '{"sucsse":true,"msg":"value","result":{"order_id":1}}';
				return JSON.parse(result);
			}else
			return result;
		}
		// 返回信息
		return {
			// 获取首页数据
			get_refund : function(callback) {
				
				var data = new Object();
				
				data.saleman = [{name:'制造商1',fouce:'4744',trade:'77143',sale:'4328262',count:'94222'}
				,{name:'制造商2',fouce:'4724',trade:'77453',sale:'482362',count:'98322'}
				,{name:'制造商3',fouce:'4734',trade:'77343',sale:'482262',count:'94542'}
				,{name:'制造商4',fouce:'4734',trade:'77343',sale:'482262',count:'94542'}
				,{name:'制造商5',fouce:'4734',trade:'77343',sale:'482262',count:'94542'}
				];
				
				data.city = [{name:'上海',fouce:'4744',trade:'77143',sale:'4328262',count:'94222'}
				,{name:'北京',fouce:'4724',trade:'77453',sale:'482362',count:'98322'}
				];

				// 函数回调
				if (callback)
					callback(data);
				
					
			
			},
			refund_list:function(type,callback){
				Http.post({
					method:'order.return.getlist',
					pagelimit:8,
					nPage:1,
					show_count:5,
					picSize:'CS',
					type:type
				},function(result){
					if(callback)
					callback(get_data_refund_list(result).result);
				},function(e){
					
				},function(){
					
				})
			},
			return_send:function(order_id,comp_id,ship_no,type,callback){
				Http.post({
					method:'',
					order_id:order_id,
					comp_id:comp_id,
					ship_no:ship_no,
					type:type
				},function(result){
					if(callback)
					callback(get_data_return_send(result));
				},function(e){
					
				},function(){
					
				})
			}
		};
	}

	factory.$inject = [ 'Http' ];
	return app.registerService("Refund", factory);
});